#pragma once
#include "Math3D.h"
#include "TgaBuffer.h"
#include "VertexProcessor.h"

namespace MASGK
{

	class CRasterizer
	{
		private:
			CBuffer				*m_Buffer;

		public:
			float				m_RcWidth;
			float				m_RcHeight;
			CVertexProcessor	*m_Vp;

								CRasterizer(void);
								~CRasterizer(void);

			void				Triangle(float3 &, float3 &, float3 &, color&, color&, color&);
			void				Triangle(float3 &, float3 &, float3 &, color&);
			void				Save();
			uint**				GetColorBuffer() { return m_Buffer->GetColorBuffer(); }
            CBuffer*            GetBuffor() { return m_Buffer; }

		private:
			int					Canonical2RcCoord(float &, int);
			float				Rc2CannonicalCoord(int &, int);
			uint				PixelLight(int, int, float, int, int, float3, uint);
	};
}
